from selenium import webdriver
from selenium.webdriver.common.by import By

driver = webdriver.Chrome()
driver.get('https://www.baidu.com')
# xpath标签索引
ipt = driver.find_element(By.XPATH, '//form/input[2]')   # 定位到第二个input标签
print(ipt.get_attribute('outerHTML'))

driver.quit()
